package imp

import (
	"bgs/db"
	productGrpc "bgs/grpc/gen/service/product"
	productGroupGrpc "bgs/grpc/gen/service/product_group"
	productService "bgs/service/product"
	"bgs/util"
	"context"

	"go.uber.org/zap"
)

// ProductAPIService :grpc server proxy of product
type ProductAPIService struct {
	dao  *db.PgDao
	slog *zap.SugaredLogger
	productGrpc.ProductOpServer
	productGroupGrpc.ProductGroupOpServer
	productService *productService.ProductServiceImp
}

// NewProductAPIService initialization
func NewProductAPIService(
	pgdao *db.PgDao,
	slog *zap.SugaredLogger,
	productService *productService.ProductServiceImp,
) *ProductAPIService {
	return &ProductAPIService{
		dao:            pgdao,
		slog:           slog.With("module", "ProductAPIService"),
		productService: productService,
	}
}

// NewContextLogger create a SugaredLogger with contextvalue
func (s *ProductAPIService) NewContextLogger(ctx context.Context) *zap.SugaredLogger {
	return util.NewContextLogger(ctx, s.slog)
}
